﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using ViewMaker;

namespace CloudStorageLight.WpfClient
{
    public class DirectorySetupVM : ViewModelBase
    {
        public string Path { get; set; }

        public bool Updated { get; set; }

        public DirectorySetupVM()
        {
            Updated = false;
            AccessTokens = new List<BlobAccessToken>();
        }

        /// <summary>
        /// アクセストークン
        /// </summary>
        public List<BlobAccessToken> AccessTokens {get; set;}

        public void SetAccessTokenString(string accessTokenString)
        {
            AccessTokens.Clear();
            foreach (var token in accessTokenString.Split(','))
            {
                var item = new BlobAccessToken(token);
                AccessTokens.Add(item);
            }
        }

        public virtual string GetAccessTokenString()
        {
            if (AccessTokens.Count == 0)
            {
                return "";
            }
            else
            {
                return string.Join(",", AccessTokens.Select(x => x.Token));
            }
        }
    }
}
